package o;

import android.graphics.Rect;
import android.os.Build.VERSION;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import FragmentTransaction.b;

class kb {
    private static final int[] ˋ = new int[]{0, 3, 0, 1, 5, 4, 7, 6, 9, 8, 10};
    private static final ke ˏ = ˏ();
    private static final ke ॱ = (VERSION.SDK_INT >= 21 ? new kh() : null);

    static class a {
        public Fragment ˊ;
        public boolean ˋ;
        public Fragment ˎ;
        public boolean ˏ;
        public jt ॱ;
        public jt ᐝ;

        a() {
        }
    }

    private static ke ˏ() {
        try {
            return (ke) Class.forName("o.nc").getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
        } catch (Exception e) {
            return null;
        }
    }

    static void ˎ(kd kdVar, ArrayList<jt> arrayList, ArrayList<Boolean> arrayList2, int i, int i2, boolean z) {
        if (kdVar.ͺ >= 1) {
            SparseArray sparseArray = new SparseArray();
            for (int i3 = i; i3 < i2; i3++) {
                jt jtVar = (jt) arrayList.get(i3);
                if (((Boolean) arrayList2.get(i3)).booleanValue()) {
                    ˊ(jtVar, sparseArray, z);
                } else {
                    ˋ(jtVar, sparseArray, z);
                }
            }
            if (sparseArray.size() != 0) {
                View view = new View(kdVar.ˋॱ.ˋॱ());
                int size = sparseArray.size();
                for (int i4 = 0; i4 < size; i4++) {
                    int keyAt = sparseArray.keyAt(i4);
                    ds ॱ = ॱ(keyAt, (ArrayList) arrayList, (ArrayList) arrayList2, i, i2);
                    a aVar = (a) sparseArray.valueAt(i4);
                    if (z) {
                        ॱ(kdVar, keyAt, aVar, view, ॱ);
                    } else {
                        ˏ(kdVar, keyAt, aVar, view, ॱ);
                    }
                }
            }
        }
    }

    private static ds<String, String> ॱ(int i, ArrayList<jt> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3) {
        ds<String, String> dsVar = new ds();
        for (int i4 = i3 - 1; i4 >= i2; i4--) {
            jt jtVar = (jt) arrayList.get(i4);
            if (jtVar.ˋ(i)) {
                boolean booleanValue = ((Boolean) arrayList2.get(i4)).booleanValue();
                if (jtVar.ॱˋ != null) {
                    ArrayList arrayList3;
                    ArrayList arrayList4;
                    int size = jtVar.ॱˋ.size();
                    if (booleanValue) {
                        arrayList3 = jtVar.ॱˋ;
                        arrayList4 = jtVar.ᐝॱ;
                    } else {
                        ArrayList arrayList5 = jtVar.ॱˋ;
                        arrayList3 = jtVar.ᐝॱ;
                        arrayList4 = arrayList5;
                    }
                    for (int i5 = 0; i5 < size; i5++) {
                        String str = (String) arrayList4.get(i5);
                        String str2 = (String) arrayList3.get(i5);
                        String str3 = (String) dsVar.remove(str2);
                        if (str3 != null) {
                            dsVar.put(str, str3);
                        } else {
                            dsVar.put(str, str2);
                        }
                    }
                }
            }
        }
        return dsVar;
    }

    private static void ॱ(kd kdVar, int i, a aVar, View view, ds<String, String> dsVar) {
        View view2 = null;
        if (kdVar.ˊॱ.d_()) {
            view2 = (ViewGroup) kdVar.ˊॱ.ˊ(i);
        }
        if (view2 != null) {
            Fragment fragment = aVar.ˎ;
            Fragment fragment2 = aVar.ˊ;
            ke ˎ = ˎ(fragment2, fragment);
            if (ˎ != null) {
                boolean z = aVar.ˋ;
                boolean z2 = aVar.ˏ;
                ArrayList arrayList = new ArrayList();
                ArrayList arrayList2 = new ArrayList();
                Object ॱ = ॱ(ˎ, fragment, z);
                Object ˎ2 = ˎ(ˎ, fragment2, z2);
                Object ˏ = ˏ(ˎ, view2, view, dsVar, aVar, arrayList2, arrayList, ॱ, ˎ2);
                if (ॱ != null || ˏ != null || ˎ2 != null) {
                    ArrayList ˊ = ˊ(ˎ, ˎ2, fragment2, arrayList2, view);
                    ArrayList ˊ2 = ˊ(ˎ, ॱ, fragment, arrayList, view);
                    ˎ(ˊ2, 4);
                    Object ˊ3 = ˊ(ˎ, ॱ, ˎ2, ˏ, fragment, z);
                    if (ˊ3 != null) {
                        ˊ(ˎ, ˎ2, fragment2, ˊ);
                        ArrayList ˏ2 = ˎ.ˏ(arrayList);
                        ˎ.ॱ(ˊ3, ॱ, ˊ2, ˎ2, ˊ, ˏ, arrayList);
                        ˎ.ˋ(view2, ˊ3);
                        ˎ.ˎ(view2, arrayList2, arrayList, ˏ2, dsVar);
                        ˎ(ˊ2, 0);
                        ˎ.ˎ(ˏ, arrayList2, arrayList);
                    }
                }
            }
        }
    }

    private static void ˊ(ke keVar, Object obj, Fragment fragment, final ArrayList<View> arrayList) {
        if (fragment != null && obj != null && fragment.ᐝॱ && fragment.ˋˋ && fragment.ᐨ) {
            fragment.ʽ(true);
            keVar.ˊ(obj, fragment.getView(), arrayList);
            hw.ˎ(fragment.ˏˏ, new Runnable() {
                public void run() {
                    kb.ˎ(arrayList, 4);
                }
            });
        }
    }

    private static void ˏ(kd kdVar, int i, a aVar, View view, ds<String, String> dsVar) {
        ViewGroup viewGroup = null;
        if (kdVar.ˊॱ.d_()) {
            viewGroup = (ViewGroup) kdVar.ˊॱ.ˊ(i);
        }
        if (viewGroup != null) {
            Fragment fragment = aVar.ˎ;
            Fragment fragment2 = aVar.ˊ;
            ke ˎ = ˎ(fragment2, fragment);
            if (ˎ != null) {
                boolean z = aVar.ˋ;
                boolean z2 = aVar.ˏ;
                Object ॱ = ॱ(ˎ, fragment, z);
                Object ˎ2 = ˎ(ˎ, fragment2, z2);
                ArrayList arrayList = new ArrayList();
                ArrayList arrayList2 = new ArrayList();
                Object ˊ = ˊ(ˎ, viewGroup, view, dsVar, aVar, arrayList, arrayList2, ॱ, ˎ2);
                if (ॱ != null || ˊ != null || ˎ2 != null) {
                    Object obj;
                    ArrayList ˊ2 = ˊ(ˎ, ˎ2, fragment2, arrayList, view);
                    if (ˊ2 == null || ˊ2.isEmpty()) {
                        obj = null;
                    } else {
                        obj = ˎ2;
                    }
                    ˎ.ˏ(ॱ, view);
                    Object ˊ3 = ˊ(ˎ, ॱ, obj, ˊ, fragment, aVar.ˋ);
                    if (ˊ3 != null) {
                        ArrayList arrayList3 = new ArrayList();
                        ˎ.ॱ(ˊ3, ॱ, arrayList3, obj, ˊ2, ˊ, arrayList2);
                        ˎ(ˎ, viewGroup, fragment, view, arrayList2, ॱ, arrayList3, obj, ˊ2);
                        ˎ.ˎ((View) viewGroup, arrayList2, (Map) dsVar);
                        ˎ.ˋ(viewGroup, ˊ3);
                        ˎ.ˏ(viewGroup, arrayList2, (Map) dsVar);
                    }
                }
            }
        }
    }

    private static void ˎ(ke keVar, ViewGroup viewGroup, Fragment fragment, View view, ArrayList<View> arrayList, Object obj, ArrayList<View> arrayList2, Object obj2, ArrayList<View> arrayList3) {
        final Object obj3 = obj;
        final ke keVar2 = keVar;
        final View view2 = view;
        final Fragment fragment2 = fragment;
        final ArrayList<View> arrayList4 = arrayList;
        final ArrayList<View> arrayList5 = arrayList2;
        final ArrayList<View> arrayList6 = arrayList3;
        final Object obj4 = obj2;
        hw.ˎ(viewGroup, new Runnable() {
            public void run() {
                if (obj3 != null) {
                    keVar2.ˊ(obj3, view2);
                    arrayList5.addAll(kb.ˊ(keVar2, obj3, fragment2, arrayList4, view2));
                }
                if (arrayList6 != null) {
                    if (obj4 != null) {
                        ArrayList arrayList = new ArrayList();
                        arrayList.add(view2);
                        keVar2.ˏ(obj4, arrayList6, arrayList);
                    }
                    arrayList6.clear();
                    arrayList6.add(view2);
                }
            }
        });
    }

    private static ke ˎ(Fragment fragment, Fragment fragment2) {
        Object ˏˎ;
        List arrayList = new ArrayList();
        if (fragment != null) {
            ˏˎ = fragment.ˏˎ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
            ˏˎ = fragment.ˏˏ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
            ˏˎ = fragment.ॱʼ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
        }
        if (fragment2 != null) {
            ˏˎ = fragment2.ˎˏ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
            ˏˎ = fragment2.ˑ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
            ˏˎ = fragment2.ͺॱ();
            if (ˏˎ != null) {
                arrayList.add(ˏˎ);
            }
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        if (ॱ != null && ˎ(ॱ, arrayList)) {
            return ॱ;
        }
        if (ˏ != null && ˎ(ˏ, arrayList)) {
            return ˏ;
        }
        if (ॱ == null && ˏ == null) {
            return null;
        }
        throw new IllegalArgumentException("Invalid Transition types");
    }

    private static boolean ˎ(ke keVar, List<Object> list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            if (!keVar.ॱ(list.get(i))) {
                return false;
            }
        }
        return true;
    }

    private static Object ˊ(ke keVar, Fragment fragment, Fragment fragment2, boolean z) {
        if (fragment == null || fragment2 == null) {
            return null;
        }
        Object ॱʼ;
        if (z) {
            ॱʼ = fragment2.ॱʼ();
        } else {
            ॱʼ = fragment.ͺॱ();
        }
        return keVar.ˏ(keVar.ˊ(ॱʼ));
    }

    private static Object ॱ(ke keVar, Fragment fragment, boolean z) {
        if (fragment == null) {
            return null;
        }
        Object ˑ;
        if (z) {
            ˑ = fragment.ˑ();
        } else {
            ˑ = fragment.ˎˏ();
        }
        return keVar.ˊ(ˑ);
    }

    private static Object ˎ(ke keVar, Fragment fragment, boolean z) {
        if (fragment == null) {
            return null;
        }
        Object ˏˏ;
        if (z) {
            ˏˏ = fragment.ˏˏ();
        } else {
            ˏˏ = fragment.ˏˎ();
        }
        return keVar.ˊ(ˏˏ);
    }

    private static Object ˏ(ke keVar, ViewGroup viewGroup, View view, ds<String, String> dsVar, a aVar, ArrayList<View> arrayList, ArrayList<View> arrayList2, Object obj, Object obj2) {
        Fragment fragment = aVar.ˎ;
        Fragment fragment2 = aVar.ˊ;
        if (fragment != null) {
            fragment.ˊˊ().setVisibility(0);
        }
        if (fragment == null || fragment2 == null) {
            return null;
        }
        Object obj3;
        Object obj4;
        boolean z = aVar.ˋ;
        if (dsVar.isEmpty()) {
            obj3 = null;
        } else {
            obj3 = ˊ(keVar, fragment, fragment2, z);
        }
        ds ˎ = ˎ(keVar, dsVar, obj3, aVar);
        final ds ˏ = ˏ(keVar, dsVar, obj3, aVar);
        if (dsVar.isEmpty()) {
            obj4 = null;
            if (ˎ != null) {
                ˎ.clear();
            }
            if (ˏ != null) {
                ˏ.clear();
            }
        } else {
            ˏ(arrayList, ˎ, dsVar.keySet());
            ˏ(arrayList2, ˏ, dsVar.values());
            obj4 = obj3;
        }
        if (obj == null && obj2 == null && obj4 == null) {
            return null;
        }
        Rect rect;
        View ˋ;
        ˎ(fragment, fragment2, z, ˎ, true);
        if (obj4 != null) {
            arrayList2.add(view);
            keVar.ˏ(obj4, view, (ArrayList) arrayList);
            ॱ(keVar, obj4, obj2, ˎ, aVar.ˏ, aVar.ᐝ);
            rect = new Rect();
            ˋ = ˋ(ˏ, aVar, obj, z);
            if (ˋ != null) {
                keVar.ˏ(obj, rect);
            }
        } else {
            rect = null;
            ˋ = null;
        }
        final Fragment fragment3 = fragment;
        final Fragment fragment4 = fragment2;
        final boolean z2 = z;
        final ke keVar2 = keVar;
        hw.ˎ(viewGroup, new Runnable() {
            public void run() {
                kb.ˎ(fragment3, fragment4, z2, ˏ, false);
                if (ˋ != null) {
                    keVar2.ˊ(ˋ, rect);
                }
            }
        });
        return obj4;
    }

    private static void ˏ(ArrayList<View> arrayList, ds<String, View> dsVar, Collection<String> collection) {
        for (int size = dsVar.size() - 1; size >= 0; size--) {
            View view = (View) dsVar.ˋ(size);
            if (collection.contains(ViewCompat.ॱˎ(view))) {
                arrayList.add(view);
            }
        }
    }

    private static Object ˊ(ke keVar, ViewGroup viewGroup, View view, ds<String, String> dsVar, a aVar, ArrayList<View> arrayList, ArrayList<View> arrayList2, Object obj, Object obj2) {
        final Fragment fragment = aVar.ˎ;
        final Fragment fragment2 = aVar.ˊ;
        if (fragment == null || fragment2 == null) {
            return null;
        }
        Object obj3;
        Object obj4;
        final boolean z = aVar.ˋ;
        if (dsVar.isEmpty()) {
            obj3 = null;
        } else {
            obj3 = ˊ(keVar, fragment, fragment2, z);
        }
        ds ˎ = ˎ(keVar, dsVar, obj3, aVar);
        if (dsVar.isEmpty()) {
            obj4 = null;
        } else {
            arrayList.addAll(ˎ.values());
            obj4 = obj3;
        }
        if (obj == null && obj2 == null && obj4 == null) {
            return null;
        }
        Rect rect;
        ˎ(fragment, fragment2, z, ˎ, true);
        if (obj4 != null) {
            rect = new Rect();
            keVar.ˏ(obj4, view, (ArrayList) arrayList);
            ॱ(keVar, obj4, obj2, ˎ, aVar.ˏ, aVar.ᐝ);
            if (obj != null) {
                keVar.ˏ(obj, rect);
            }
        } else {
            rect = null;
        }
        final ke keVar2 = keVar;
        final ds<String, String> dsVar2 = dsVar;
        final Object obj5 = obj4;
        final a aVar2 = aVar;
        final ArrayList<View> arrayList3 = arrayList2;
        final View view2 = view;
        final ArrayList<View> arrayList4 = arrayList;
        final Object obj6 = obj;
        hw.ˎ(viewGroup, new Runnable() {
            public void run() {
                ds ˏ = kb.ˏ(keVar2, dsVar2, obj5, aVar2);
                if (ˏ != null) {
                    arrayList3.addAll(ˏ.values());
                    arrayList3.add(view2);
                }
                kb.ˎ(fragment, fragment2, z, ˏ, false);
                if (obj5 != null) {
                    keVar2.ˎ(obj5, arrayList4, arrayList3);
                    View ˋ = kb.ˋ(ˏ, aVar2, obj6, z);
                    if (ˋ != null) {
                        keVar2.ˊ(ˋ, rect);
                    }
                }
            }
        });
        return obj4;
    }

    private static ds<String, View> ˎ(ke keVar, ds<String, String> dsVar, Object obj, a aVar) {
        if (dsVar.isEmpty() || obj == null) {
            dsVar.clear();
            return null;
        }
        ArrayList arrayList;
        fm fmVar;
        Fragment fragment = aVar.ˊ;
        Map dsVar2 = new ds();
        keVar.ˎ(dsVar2, fragment.ˊˊ());
        jt jtVar = aVar.ᐝ;
        fm ﾞ;
        if (aVar.ˏ) {
            ﾞ = fragment.ﾞ();
            arrayList = jtVar.ᐝॱ;
            fmVar = ﾞ;
        } else {
            ﾞ = fragment.ʼˋ();
            arrayList = jtVar.ॱˋ;
            fmVar = ﾞ;
        }
        dsVar2.ˋ(arrayList);
        if (fmVar != null) {
            fmVar.ॱ(arrayList, dsVar2);
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                String str = (String) arrayList.get(size);
                View view = (View) dsVar2.get(str);
                if (view == null) {
                    dsVar.remove(str);
                } else if (!str.equals(ViewCompat.ॱˎ(view))) {
                    dsVar.put(ViewCompat.ॱˎ(view), (String) dsVar.remove(str));
                }
            }
        } else {
            dsVar.ˋ(dsVar2.keySet());
        }
        return dsVar2;
    }

    static ds<String, View> ˏ(ke keVar, ds<String, String> dsVar, Object obj, a aVar) {
        Fragment fragment = aVar.ˎ;
        View view = fragment.getView();
        if (dsVar.isEmpty() || obj == null || view == null) {
            dsVar.clear();
            return null;
        }
        ArrayList arrayList;
        fm fmVar;
        Map dsVar2 = new ds();
        keVar.ˎ(dsVar2, view);
        jt jtVar = aVar.ॱ;
        fm ʼˋ;
        if (aVar.ˋ) {
            ʼˋ = fragment.ʼˋ();
            arrayList = jtVar.ॱˋ;
            fmVar = ʼˋ;
        } else {
            ʼˋ = fragment.ﾞ();
            arrayList = jtVar.ᐝॱ;
            fmVar = ʼˋ;
        }
        if (arrayList != null) {
            dsVar2.ˋ(arrayList);
            dsVar2.ˋ(dsVar.values());
        }
        if (fmVar != null) {
            fmVar.ॱ(arrayList, dsVar2);
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                String str = (String) arrayList.get(size);
                view = (View) dsVar2.get(str);
                if (view == null) {
                    str = ˋ(dsVar, str);
                    if (str != null) {
                        dsVar.remove(str);
                    }
                } else if (!str.equals(ViewCompat.ॱˎ(view))) {
                    str = ˋ(dsVar, str);
                    if (str != null) {
                        dsVar.put(str, ViewCompat.ॱˎ(view));
                    }
                }
            }
        } else {
            ˊ(dsVar, dsVar2);
        }
        return dsVar2;
    }

    private static String ˋ(ds<String, String> dsVar, String str) {
        int size = dsVar.size();
        for (int i = 0; i < size; i++) {
            if (str.equals(dsVar.ˋ(i))) {
                return (String) dsVar.ॱ(i);
            }
        }
        return null;
    }

    static View ˋ(ds<String, View> dsVar, a aVar, Object obj, boolean z) {
        jt jtVar = aVar.ॱ;
        if (obj == null || dsVar == null || jtVar.ॱˋ == null || jtVar.ॱˋ.isEmpty()) {
            return null;
        }
        Object obj2;
        if (z) {
            obj2 = (String) jtVar.ॱˋ.get(0);
        } else {
            String str = (String) jtVar.ᐝॱ.get(0);
        }
        return (View) dsVar.get(obj2);
    }

    private static void ॱ(ke keVar, Object obj, Object obj2, ds<String, View> dsVar, boolean z, jt jtVar) {
        if (jtVar.ॱˋ != null && !jtVar.ॱˋ.isEmpty()) {
            Object obj3;
            if (z) {
                obj3 = (String) jtVar.ᐝॱ.get(0);
            } else {
                String str = (String) jtVar.ॱˋ.get(0);
            }
            View view = (View) dsVar.get(obj3);
            keVar.ˎ(obj, view);
            if (obj2 != null) {
                keVar.ˎ(obj2, view);
            }
        }
    }

    private static void ˊ(ds<String, String> dsVar, ds<String, View> dsVar2) {
        for (int size = dsVar.size() - 1; size >= 0; size--) {
            if (!dsVar2.containsKey((String) dsVar.ˋ(size))) {
                dsVar.ˏ(size);
            }
        }
    }

    static void ˎ(Fragment fragment, Fragment fragment2, boolean z, ds<String, View> dsVar, boolean z2) {
        fm ﾞ;
        int i = 0;
        if (z) {
            ﾞ = fragment2.ﾞ();
        } else {
            ﾞ = fragment.ﾞ();
        }
        if (ﾞ != null) {
            List arrayList = new ArrayList();
            List arrayList2 = new ArrayList();
            int size = dsVar == null ? 0 : dsVar.size();
            while (i < size) {
                arrayList2.add(dsVar.ॱ(i));
                arrayList.add(dsVar.ˋ(i));
                i++;
            }
            if (z2) {
                ﾞ.ˊ(arrayList2, arrayList, null);
            } else {
                ﾞ.ˏ(arrayList2, arrayList, null);
            }
        }
    }

    static ArrayList<View> ˊ(ke keVar, Object obj, Fragment fragment, ArrayList<View> arrayList, View view) {
        ArrayList<View> arrayList2 = null;
        if (obj != null) {
            arrayList2 = new ArrayList();
            View view2 = fragment.getView();
            if (view2 != null) {
                keVar.ˎ((ArrayList) arrayList2, view2);
            }
            if (arrayList != null) {
                arrayList2.removeAll(arrayList);
            }
            if (!arrayList2.isEmpty()) {
                arrayList2.add(view);
                keVar.ॱ(obj, arrayList2);
            }
        }
        return arrayList2;
    }

    static void ˎ(ArrayList<View> arrayList, int i) {
        if (arrayList != null) {
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                ((View) arrayList.get(size)).setVisibility(i);
            }
        }
    }

    private static Object ˊ(ke keVar, Object obj, Object obj2, Object obj3, Fragment fragment, boolean z) {
        boolean z2 = true;
        if (!(obj == null || obj2 == null || fragment == null)) {
            z2 = z ? fragment.ॱʻ() : fragment.ॱͺ();
        }
        if (z2) {
            return keVar.ॱ(obj2, obj, obj3);
        }
        return keVar.ˏ(obj2, obj, obj3);
    }

    public static void ˋ(jt jtVar, SparseArray<a> sparseArray, boolean z) {
        int size = jtVar.ˋ.size();
        for (int i = 0; i < size; i++) {
            ˎ(jtVar, (b) jtVar.ˋ.get(i), (SparseArray) sparseArray, false, z);
        }
    }

    public static void ˊ(jt jtVar, SparseArray<a> sparseArray, boolean z) {
        if (jtVar.ˏ.ˊॱ.d_()) {
            for (int size = jtVar.ˋ.size() - 1; size >= 0; size--) {
                ˎ(jtVar, (b) jtVar.ˋ.get(size), (SparseArray) sparseArray, true, z);
            }
        }
    }

    private static void ˎ(jt jtVar, b bVar, SparseArray<a> sparseArray, boolean z, boolean z2) {
        Fragment fragment = bVar.ॱ;
        if (fragment != null) {
            int i = fragment.ˍ;
            if (i != 0) {
                int i2;
                int i3;
                a ˎ;
                boolean z3;
                int i4;
                int i5;
                boolean z4;
                int i6;
                switch (z ? ˋ[bVar.ˊ] : bVar.ˊ) {
                    case 1:
                    case 7:
                        z3 = z2 ? fragment.ᐧ : (fragment.ᐝॱ || fragment.ˋˋ) ? false : true;
                        i4 = 1;
                        i2 = 0;
                        i5 = 0;
                        z4 = z3;
                        break;
                    case 3:
                    case 6:
                        i6 = z2 ? (fragment.ᐝॱ || fragment.ॱʼ == null || fragment.ॱʼ.getVisibility() != 0 || fragment.ᐝᐝ < 0.0f) ? 0 : 1 : (!fragment.ᐝॱ || fragment.ˋˋ) ? 0 : 1;
                        i4 = 0;
                        i2 = i6;
                        i5 = 1;
                        i3 = 0;
                        break;
                    case 4:
                        i6 = z2 ? (fragment.ᐨ && fragment.ᐝॱ && fragment.ˋˋ) ? 1 : 0 : (!fragment.ᐝॱ || fragment.ˋˋ) ? 0 : 1;
                        i4 = 0;
                        i2 = i6;
                        i5 = 1;
                        i3 = 0;
                        break;
                    case 5:
                        z3 = z2 ? fragment.ᐨ && !fragment.ˋˋ && fragment.ᐝॱ : fragment.ˋˋ;
                        i4 = 1;
                        i2 = 0;
                        i5 = 0;
                        z4 = z3;
                        break;
                    default:
                        i4 = 0;
                        i2 = 0;
                        i5 = 0;
                        i3 = 0;
                        break;
                }
                a aVar = (a) sparseArray.get(i);
                if (i3 != 0) {
                    ˎ = ˎ(aVar, (SparseArray) sparseArray, i);
                    ˎ.ˎ = fragment;
                    ˎ.ˋ = z;
                    ˎ.ॱ = jtVar;
                } else {
                    ˎ = aVar;
                }
                if (!(z2 || r4 == 0)) {
                    if (ˎ != null && ˎ.ˊ == fragment) {
                        ˎ.ˊ = null;
                    }
                    kd kdVar = jtVar.ˏ;
                    if (fragment.ͺ < 1 && kdVar.ͺ >= 1 && !jtVar.ॱᐝ) {
                        kdVar.ͺ(fragment);
                        kdVar.ˏ(fragment, 1, 0, 0, false);
                    }
                }
                if (i2 == 0 || !(ˎ == null || ˎ.ˊ == null)) {
                    aVar = ˎ;
                } else {
                    aVar = ˎ(ˎ, (SparseArray) sparseArray, i);
                    aVar.ˊ = fragment;
                    aVar.ˏ = z;
                    aVar.ᐝ = jtVar;
                }
                if (!z2 && r7 != 0 && aVar != null && aVar.ˎ == fragment) {
                    aVar.ˎ = null;
                }
            }
        }
    }

    private static a ˎ(a aVar, SparseArray<a> sparseArray, int i) {
        if (aVar != null) {
            return aVar;
        }
        aVar = new a();
        sparseArray.put(i, aVar);
        return aVar;
    }
}
